import {
	Tools,
	Config,
	URL,
	Net,
	VueTools
} from '@/common/tools.js';
export default{
	state: {
		userInfo:{},//用户信息
		isTestPlay:false, //是否试玩
		isLogin:false
	},
	mutations: {
		/**
		 * 获取用户的信息
		 * @param {Object} state
		 */
		getUserInfo(state){
			let res=VueTools.getStorageSync(Config.USERINFO_KEY);
			state.userInfo=res;
		},
		/**
		 * 判断用户是否是试玩账号
		 * @param {Object} state
		 */
		isTestPlay(state){
			let temp=VueTools.getStorageSync(Config.ROLE_KEY);
			if (temp == '2' || temp == 2) {
				state.isTestPlay=true;
			}
			state.isTestPlay=false;
		},
		/**
		 * 判断用户是否登录了
		 * @param {Object} state
		 */
		isLogin(state){
			let temp=VueTools.getStorageSync(Config.IS_LOGIN_STORE_KEY);
			if(Tools.isEmpty(temp)){
				state.isLogin=false;
			}else{
				state.isLogin=true;
			}
		}
	},
	actions: {}
}